<div ba-panel ba-panel-title="通道列表" ba-panel-class="custom-panel with-scroll light-text">
    <div class="row add-row-editable-table">
        <div has-perms='pdev.channel.add' class="col-md-4">
            <button class="btn btn-success btn-with-icon" ui-sref="pdev.channel.add">
                <i class="ion-plus-round"></i>新增
            </button>
        </div>
        <div class="col-md-offset-8">
            <div class="form-group col-md-6">
                <input type="text" class="form-control form-control-rounded" ng-model="kt.tableState.search.name"
                       input-keyup="kt.LoadPage" placeholder="传感器名称">
            </div>
            <div class="form-group col-md-6">
                <input type="text" class="form-control form-control-rounded" ng-model="kt.tableState.search.type"
                       input-keyup="kt.LoadPage" placeholder="传感器类型">
            </div>
        </div>
    </div>
    <table class="table table-bordered table-hover table-condensed" st-pipe="kt.LoadPage"
           st-table="kt.channellist">
        <thead>
        <tr class="sortable">
            <th>
                <label class="table-checkbox checkbox-inline custom-checkbox nowrap">
                    <input type="checkbox" ng-model="kt.checkboxes.checked">
                    <span></span>
                </label>
            </th>
            <th>序号</th>
            <th>设备名称</th>
            <th>传感器名称</th>
            <th>通道编号</th>
            <th>传感器类型</th>
            <th>当前值</th>
            <th>单位</th>
            <th>更新时间</th>
            <th>是否可用</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="channel in kt.channellist">
            <td class="check-td">
                <div class="mail-checkbox">
                    <label class="checkbox-inline custom-checkbox nowrap">
                        <input type="checkbox" ng-model="kt.checkboxes.items[channel.id]">
                        <span></span>
                    </label>
                </div>
            </td>
            <td>{{$index+1}}</td>
            <td>
                {{kt.showDevName(channel.deviceUid)}}
            </td>
            <td>
                {{channel.name}}
            </td>
            <td>
                {{channel.number}}
            </td>
            <td>
                {{channel.type}}
            </td>
            <td>
                {{channel.val}}
            </td>
            <td>
                {{channel.unit}}
            </td>
            <td>
                {{channel.updateTime}}
            </td>
            <td>
                {{kt.getDictLabel('DEVICESTATUS', channel.isActive)}}

                <button has-perms='pdev.channel.edit' class="btn editable-table-button btn-xs btn-with-icon"
                        ng-click="kt.active({id:channel.id, active: channel.isActive == '0' ? '1' : '0', title: kt.getDictLabel('DEVICESTATUS', channel.isActive == '0' ? '1' : '0')})"
                        ng-class="{true: 'btn-danger', false: 'btn-info'}[channel.isActive == '1']">
                    {{kt.getDictLabel('DEVICESTATUS', channel.isActive == '0' ? '1' : '0')}}
                </button>
            </td>
            <td>
                <div class="buttons">
                    <button has-perms='pdev.channel.view' class="btn btn-info editable-table-button btn-xs btn-with-icon"
                            ui-sref="pdev.channel.view({id:channel.id,isView:true})"><i class="ion-search"></i>查看
                    </button>
                    <button has-perms='pdev.channel.view' class="btn btn-info editable-table-button btn-xs btn-with-icon"
                            ng-click="kt.showCharts(channel.id)"><i class="ion-search"></i>图表
                    </button>
                    <button has-perms='pdev.channel.edit' class="btn btn-warning editable-table-button btn-xs btn-with-icon"
                            ui-sref="pdev.channel.view({id:channel.id})"><i class="ion-edit"></i>编辑
                    </button>
                    <button has-perms='pdev.channel.delete' class="btn btn-danger editable-table-button btn-xs btn-with-icon"
                            ng-click="kt.del(channel.id)"><i class="ion-trash-a"></i>删除
                    </button>
                </div>
            </td>
        </tr>
        </tbody>
        <tfoot>
        <tr>
            <td colspan="11" class="text-center">
                <div st-pagination="" st-items-by-page="10"
                     st-template="app/pages/common/pagination.html"></div>
            </td>
        </tr>
        </tfoot>
    </table>
</div>